import { apiPrefix } from '@/consts/consts'

export default ({ $service:request }) => ({
  // 4.6.1. 资源列表
  resourceList(params) {
    return request({
      url: `${apiPrefix}/api/v1/resource/list`,
      method: 'get',
      params
    })
  },

  //4.6.2. 资源新增
  resourceAdd(data) {
    return request({
      url: `${apiPrefix}/api/v1/resource/add`,
      method: 'post',
      data
    })
  },
  
  // 4.6.3. 资源修改
  resourceUpdate(data, id) {
    return request({
      url: `${apiPrefix}/api/v1/resource/update/${id}`,
      method: 'put',
      data
    })
  },
    
  // 4.6.4. 资源删除
  resourceDelete(id) {
    return request({
      url: `${apiPrefix}/api/v1/resource/delete/${id}`,
      method: 'delete',
    })
  },
    
  // 4.6.5. 资源同步
  resourceSync() {
    return request({
      url: `${apiPrefix}/api/v1/resource/sync`,
      method: 'post',
    })
  },
      
  // 4.6.6. 资源绑定应用
  resourceBindApp(data, id) {
    return request({
      url: `${apiPrefix}/api/v1/resource/bind/app/${id}`,
      method: 'post',
      data
    })
  },
        
  // 4.6.7. 资源审核
  resourceExamine(data) {
    return request({
      url: `${apiPrefix}/api/v1/resource/examine`,
      method: 'post',
      data
    })
  },
})
